﻿<!DOCTYPE HTML>
<html>
<head th:include="fragments/_header :: _head('项目列表')"></head>
<body>
<div class="page-container">
	<!--<div class="cl pd-5 bg-1 bk-gray">-->
		<!--<span class="l">-->
			<!--<a href="javascript:;" onclick="add('添加选项','/project/item/add','500','400')" class="btn btn-primary radius"><i class="Hui-iconfont">&#xe600;</i> 添加选项</a>-->
		<!--</span>-->
		<!--<span class="r">共有数据：<strong th:text="${page.total}">0</strong> 条</span>-->
	<!--</div>-->
	<!--<div class="text-c mt-20">-->
		<!--<form action="/project/item/list" id="searchForm">-->
			<!--&lt;!&ndash;<input type="text" class="input-text" style="width:250px" placeholder="输入选项名称" id="name" name="name">&ndash;&gt;-->
			<!--&lt;!&ndash;<input type="hidden" name="page" id="page" th:value="${page.current}">&ndash;&gt;-->
			<!--<input type="hidden" name="projectId" id="projectId" th:value="${projectId}">-->
			<!--&lt;!&ndash;<button type="submit" class="btn btn-success" id="" name=""><i class="Hui-iconfont">&#xe665;</i> 搜选项</button>&ndash;&gt;-->
		<!--</form>-->
	<!--</div>-->
	<div class="dataTables_wrapper no-footer  mt-20">
		<table class="table table-border table-bordered table-bg">
			<thead>
				<tr>
					<th scope="col" colspan="5">选项列表</th>
				</tr>
				<tr class="text-c">
					<th width="150">名称</th>
					<th width="100">赔率</th>
					<th width="100">排序</th>
					<th width="130">编码</th>
					<th width="100">操作</th>
				</tr>
			</thead>
			<tbody>
				<tr class="text-c"  th:each="project:${page}">
					<td th:text="${project.name}">project</td>
					<td><input class="odds" name="percent" th:value="${project.percent}" th:aid="${project.projectId}" th:bid="${project.code}" ></td>
					<td th:text="${project.order}">13000000000</td>
					<td th:text="${project.code}">project@mail.com</td>
					<td class="td-manage">
						<a style="text-decoration:none" class="btn btn-primary radius" th:aid="${project.id}" href="javascript:;" onclick="modify('修改','/project/item/add',this,'400','300')" title="修改">修改</a>
					</td>
				</tr>
			</tbody>
		</table>
	</div>
</div>
<div th:include="fragments/_footer :: _footer"></div>
<script type="text/javascript" src="/lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
<script type="text/javascript">
/*用户-增加*/
function add(title,url,w,h){
    var pid = $("#projectId").val();
	layer_show(title,url+"?projectId=" + pid,w,h);
}


/*用户-编辑*/
function modify(title,url,obj,w,h){
    var id = $(obj).attr("aid");
    var pid = $("#projectId").val();
    layer_show(title, url + "?id=" + id+"&projectId="+pid, w, h);
}
$(function(){
	$(".odds").blur(function(){
	    var projectId=$(this).attr("aid");
	    var code=$(this).attr("bid");
	    var odds=$(this).val();
		$.post("/project/item/odds", {projectId:projectId,code:code,percent:odds},
				function(result){
                    if (result.success) {
                        layer.msg("修改成功", {icon: 1, time: 1000});
                    } else {
                        layer.msg(result.msg, {icon: 2, time: 1000});
                        parent.window.location.reload();
                    }
		});
	});
});
</script>
</body>
</html>